<?php

add_action('init', 'add_arc_button');

function add_arc_button() {
	if ( current_user_can('edit_posts') && current_user_can('edit_pages') ){
		add_filter('mce_external_plugins', 'add_plugin');
		add_filter('mce_buttons', 'register_button');
	}
}

function register_button($buttons) {
	array_push($buttons, "|", "shortcodes");
	return $buttons;
}  

function add_plugin($plugin_array) {
	$plugin_array['shortcodes'] = get_template_directory_uri().'/functions/custom/wysiwyg/editor.js';
	return $plugin_array;
}  


add_action('init', 'add_arc_button_authors');

function add_arc_button_authors() {
	if ( current_user_can('edit_posts') && !current_user_can('edit_pages') ){
		add_filter('mce_external_plugins', 'add_plugin_author');
		add_filter('mce_buttons', 'register_button_author');
	}
}

function register_button_author($buttons) {
	array_push($buttons, "|", "shortcodes");
	return $buttons;
}  

function add_plugin_author($plugin_array) {
	$plugin_array['shortcodes'] = get_template_directory_uri().'/functions/custom/wysiwyg/editor_author.js';
	return $plugin_array;
}  


?>